#pragma once
#include <memory>
#include "InnerType.h"

namespace xncc {
namespace foundation {

    class EventLoop;
    class XnccAddress;
    class XnccClient
    {
      public:
        XnccClient()          = default;
        virtual ~XnccClient() = default;

        XnccClient(const XnccClient&&) = delete;

        XnccClient(const XnccClient&) = delete;

        XnccClient& operator=(const XnccClient&)  = delete;
        XnccClient& operator=(const XnccClient&&) = delete;

        virtual void               init()                                   = 0;
        virtual void               connect()                                = 0;
        [[nodiscard]] virtual auto Type() const -> shared::XNCC_CLIENT_TYPE = 0;
        void                       enableRetry(int ms);

        static XnccClient* CreateXnccClient(EventLoop*, std::shared_ptr<XnccAddress>, const std::string&);
        static void        Destory(XnccClient*);

      protected:
        bool retry_        = {false};  // atomic
        int  retryDelayMs_ = {1000};
    };
}  // namespace foundation
}  // namespace xncc